//
//  AddVenueVipView.m
//  fitnessmanage
//
//  Created by 众拳科技 on 2017/10/26.
//  Copyright © 2017年 zongquankeji. All rights reserved.
//

#import "AddVenueVipView.h"

@implementation AddVenueVipView

-(id)initWithFrame:(CGRect)frame{
    
    self = [super initWithFrame:frame];
    
    if (self) {
        
        self.backgroundColor = CSWhiteColor;
        
        UIScrollView *scrollView = [[UIScrollView alloc] init];
        [self addSubview:scrollView];
        self.scrollView = scrollView;
        
        UIView *noticeView = [[UIView alloc] init];
        noticeView.backgroundColor = CSColorFromRGB(0xfaf6eb);
        [scrollView addSubview:noticeView];
        self.noticeView = noticeView;
        
        //图片
        UIImageView *imageView = [[UIImageView alloc] init];
        imageView.image = [UIImage imageNamed:@"prompt_icon_careful"];
        [scrollView addSubview:imageView];
        self.imageView = imageView;
        
        /**
         提示Label
         */
        UILabel *noticeLabel = [[UILabel alloc] init];
        noticeLabel.font = [UIFont systemFontOfSize:11.0];
        noticeLabel.textColor = CSColorFromRGB(0x737373);
        noticeLabel.adjustsFontSizeToFitWidth = YES;
        noticeLabel.text = @"添加会员照片可以帮助工作人员在签到、预约时辨别会员真是情况";
        [scrollView addSubview:noticeLabel];
        self.noticeLabel = noticeLabel;
        
        /**
         照片按钮
         */
        UIButton *vipPhotoBtn = [[UIButton alloc] init];
        vipPhotoBtn.layer.cornerRadius = 30;
        vipPhotoBtn.layer.masksToBounds = YES;
        [vipPhotoBtn setImage:@"courseshare_icon_addimg"];
        vipPhotoBtn.imageView.contentMode = UIViewContentModeScaleAspectFill;
        vipPhotoBtn.imageView.layer.masksToBounds = YES;
        [scrollView addSubview:vipPhotoBtn];
        self.vipPhotoBtn = vipPhotoBtn;
        
        /**
         会员照片
         */
        UILabel *vipPhotoLabel = [[UILabel alloc] init];
        vipPhotoLabel.font = MidFont;
        vipPhotoLabel.textColor = CSColorFromRGB(0x999999);
        vipPhotoLabel.text = @"会员头像";
        [scrollView addSubview:vipPhotoLabel];
        self.vipPhotoLabel = vipPhotoLabel;
        
        /**
         线条
         */
        UIView *lineView = [[UIView alloc] init];
        lineView.backgroundColor = BackGroundColor;
        [scrollView addSubview:lineView];
        self.lineView = lineView;
        
        /**
         姓名
         */
        CommonInputView *nameInputView = [[CommonInputView alloc] init];
        nameInputView.titleLabel.text = @"姓名*";
        nameInputView.titleTF.placeholder = @"填写姓名";
        [scrollView addSubview:nameInputView];
        self.nameInputView = nameInputView;
        
        /**
         性别
         */
        CommonBtnView *sexBtnView = [[CommonBtnView alloc] init];
        sexBtnView.titleLabel.text = @"性别*";
        sexBtnView.choseLabel.text = @"请选择性别";
        sexBtnView.choseLabel.textColor = PlaceHoldColor;
        [scrollView addSubview:sexBtnView];
        self.sexBtnView = sexBtnView;
        
        /**
         手机
         */
        CommonInputView *phoneInputView = [[CommonInputView alloc] init];
        phoneInputView.titleLabel.text = @"手机*";
        phoneInputView.titleTF.placeholder = @"填写手机号";
        [scrollView addSubview:phoneInputView];
        self.phoneInputView = phoneInputView;
        
        /**
         生日
         */
        CommonBtnView *brithBtnView = [[CommonBtnView alloc] init];
        brithBtnView.titleLabel.text = @"生日*";
        brithBtnView.choseLabel.text = @"请选择生日";
        brithBtnView.choseLabel.textColor = PlaceHoldColor;
        [scrollView addSubview:brithBtnView];
        self.brithBtnView = brithBtnView;
        
        /**
         身高
         */
        CommonInputView *hInputView = [[CommonInputView alloc] init];
        hInputView.titleLabel.text = @"身高(cm)*";
        hInputView.titleTF.placeholder = @"填写身高";
        [scrollView addSubview:hInputView];
        self.heightInputView = hInputView;
        
        
        /**
         体重
         */
        CommonInputView *wInputView = [[CommonInputView alloc] init];
        wInputView.titleLabel.text = @"体重(KG)*";
        wInputView.titleTF.placeholder = @"填写体重";
        [scrollView addSubview:wInputView];
        self.weightInputView = wInputView;
        
        /**
         工作经验
         */
        CommonBtnView *jobBtnView = [[CommonBtnView alloc] init];
        jobBtnView.titleLabel.text = @"工作经验*";
        jobBtnView.choseLabel.text = @"选择工作经验";
        jobBtnView.choseLabel.textColor = PlaceHoldColor;
        [scrollView addSubview:jobBtnView];
        self.jobExperBtnView = jobBtnView;
        
        /**
         地址
         */
        CommonInputView *addrInputView = [[CommonInputView alloc] init];
        addrInputView.titleLabel.text = @"详细地址*";
        [scrollView addSubview:addrInputView];
        self.addrInputView = addrInputView;
        
        /**
         备注
         */
        CommonBtnView *remarkBtnView = [[CommonBtnView alloc] init];
        remarkBtnView.titleLabel.text = @"备注";
        remarkBtnView.choseLabel.text = @"请选择";
        remarkBtnView.choseLabel.textColor = PlaceHoldColor;
        [scrollView addSubview:remarkBtnView];
        self.remarkBtnView = remarkBtnView;
        
        /**
         线条
         */
        UIView *lineView1 = [[UIView alloc] init];
        lineView1.backgroundColor = BackGroundColor;
        [scrollView addSubview:lineView1];
        self.lineView1 = lineView1;
        
        /**
         会员卡号
         */
        CommonInputView *vipCardInputView = [[CommonInputView alloc] init];
        vipCardInputView.titleLabel.text = @"会员卡号*";
        [scrollView addSubview:vipCardInputView];
        self.vipCardInputView = vipCardInputView;
        
        /**
         会员等级
         */
        CommonBtnView *vipLevelBtnView = [[CommonBtnView alloc] init];
        vipLevelBtnView.titleLabel.text = @"会员等级*";
        vipLevelBtnView.choseLabel.text = @"请选择";
        vipLevelBtnView.choseLabel.textColor = PlaceHoldColor;
        [scrollView addSubview:vipLevelBtnView];
        self.vipLevelBtnView = vipLevelBtnView;
        
        /**
         线条
         */
        UIView *lineView2 = [[UIView alloc] init];
        lineView2.backgroundColor = BackGroundColor;
        [scrollView addSubview:lineView2];
        self.lineView2 = lineView2;
        
        /**
         紧急联系人
         */
        CommonInputView *contactInputView = [[CommonInputView alloc] init];
        contactInputView.titleLabel.text = @"紧急联系人";
        [scrollView addSubview:contactInputView];
        self.contactInputView = contactInputView;
        
        /**
         紧急联系号码
         */
        CommonInputView *contactPhoneInputView = [[CommonInputView alloc] init];
        contactPhoneInputView.titleLabel.text = @"紧急联系号码";
        [scrollView addSubview:contactPhoneInputView];
        self.contactPhoneInputView = contactPhoneInputView;
        
        /**
         来源
         */
        CommonBtnView *sourceBtnView = [[CommonBtnView alloc] init];
        sourceBtnView.titleLabel.text = @"来源";
        sourceBtnView.choseLabel.text = @"请选择来源";
        sourceBtnView.choseLabel.textColor = PlaceHoldColor;
        [scrollView addSubview:sourceBtnView];
        self.sourceBtnView = sourceBtnView;
        
        [self setConstraints];
    }
    
    return self;
}

-(void)setConstraints{
    
    [self.scrollView mas_remakeConstraints:^(MASConstraintMaker *make) {
       
        make.edges.mas_equalTo(self);
    }];
    
    [self.noticeView mas_remakeConstraints:^(MASConstraintMaker *make) {
        
        make.top.left.width.mas_equalTo(self.scrollView);
        
        make.height.mas_equalTo(40);
    }];
    
    [self.imageView mas_remakeConstraints:^(MASConstraintMaker *make) {
        
        make.centerY.mas_equalTo(self.noticeView);
        
        make.left.mas_equalTo(self.scrollView).offset(13);
        
        //make.width.mas_offset(10);
    }];
    
    /**
     提示Label
     */
    [self.noticeLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
        
        make.left.mas_equalTo(self.imageView.mas_right).offset(5);
        
        make.centerY.mas_equalTo(self.noticeView);
        
        make.width.mas_equalTo(SCREEN_WIDTH - 20);
        
    }];
    
    
    /**
     照片按钮
     */
    [self.vipPhotoBtn mas_remakeConstraints:^(MASConstraintMaker *make) {
        
        make.centerX.mas_equalTo(self.scrollView);
        
        make.top.mas_equalTo(self.noticeView.mas_bottom).offset(15);
        
        make.width.height.mas_equalTo(60);
    }];
    
    /**
     会员照片
     */
    [self.vipPhotoLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(self.vipPhotoBtn.mas_bottom).offset(10);
        
        make.centerX.mas_equalTo(self.vipPhotoBtn);
    }];
    
    [self.lineView mas_remakeConstraints:^(MASConstraintMaker *make) {
       
        make.top.mas_equalTo(self.vipPhotoLabel.mas_bottom).offset(20);
        
        make.left.width.mas_equalTo(self.scrollView);
        
        make.height.mas_equalTo(8);
    }];
    
    /**
     姓名
     */
    [self.nameInputView mas_remakeConstraints:^(MASConstraintMaker *make) {

        make.top.mas_equalTo(self.lineView.mas_bottom);

        make.left.width.mas_equalTo(self);
    }];

    /**
     性别
     */
    [self.sexBtnView mas_remakeConstraints:^(MASConstraintMaker *make) {

        make.top.mas_equalTo(self.nameInputView.mas_bottom);

        make.left.width.mas_equalTo(self.scrollView);
    }];

    /**
     手机
     */
    [self.phoneInputView mas_remakeConstraints:^(MASConstraintMaker *make) {

        make.top.mas_equalTo(self.sexBtnView.mas_bottom);

        make.left.width.mas_equalTo(self.scrollView);
    }];

    /**
     生日
     */
    [self.brithBtnView mas_remakeConstraints:^(MASConstraintMaker *make) {

        make.top.mas_equalTo(self.phoneInputView.mas_bottom);

        make.left.width.mas_equalTo(self.scrollView);
    }];
    /**
     身高
     */
    [self.heightInputView mas_remakeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(self.brithBtnView.mas_bottom);
        
        make.left.width.mas_equalTo(self.scrollView);
    }];
    /**
     体重
     */
    [self.weightInputView mas_remakeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(self.heightInputView.mas_bottom);
        
        make.left.width.mas_equalTo(self.scrollView);
    }];
    /**
     工作经验
     */
    [self.jobExperBtnView mas_remakeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(self.weightInputView.mas_bottom);
        
        make.left.width.mas_equalTo(self.scrollView);
    }];

    /**
     地址
     */
    [self.addrInputView mas_remakeConstraints:^(MASConstraintMaker *make) {

        make.top.mas_equalTo(self.jobExperBtnView.mas_bottom);

        make.left.width.mas_equalTo(self.scrollView);
    }];

    /**
     备注
     */
    [self.remarkBtnView mas_remakeConstraints:^(MASConstraintMaker *make) {

        make.top.mas_equalTo(self.addrInputView.mas_bottom);

        make.left.width.mas_equalTo(self.scrollView);
    }];

    [self.lineView1 mas_remakeConstraints:^(MASConstraintMaker *make) {

        make.top.mas_equalTo(self.remarkBtnView.mas_bottom);

        make.left.width.mas_equalTo(self.scrollView);

        make.height.mas_equalTo(8);
    }];
    
    /**
    会员卡号
    */
    [self.vipCardInputView mas_remakeConstraints:^(MASConstraintMaker *make) {

        make.top.mas_equalTo(self.lineView1.mas_bottom);

        make.left.width.mas_equalTo(self.scrollView);
    }];

    
    
    /**
     会员等级
     */
    [self.vipLevelBtnView mas_remakeConstraints:^(MASConstraintMaker *make) {

        make.top.mas_equalTo(self.vipCardInputView.mas_bottom);

        make.left.width.mas_equalTo(self.scrollView);
    }];
    
    [self.lineView2 mas_remakeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(self.vipLevelBtnView.mas_bottom);
        
        make.left.width.mas_equalTo(self.scrollView);
        
        make.height.mas_equalTo(8);
    }];

    /**
     紧急联系人
     */
    [self.contactInputView mas_remakeConstraints:^(MASConstraintMaker *make) {

        make.top.mas_equalTo(self.lineView2.mas_bottom).offset(10);

        make.left.width.mas_equalTo(self.scrollView);
    }];

    /**
     紧急联系号码
     */
    [self.contactPhoneInputView mas_remakeConstraints:^(MASConstraintMaker *make) {

        make.top.mas_equalTo(self.contactInputView.mas_bottom);

        make.left.width.mas_equalTo(self.scrollView);
    }];

    /**
     来源
     */
    [self.sourceBtnView mas_remakeConstraints:^(MASConstraintMaker *make) {

        make.top.mas_equalTo(self.contactPhoneInputView.mas_bottom);

        make.left.width.mas_equalTo(self.scrollView);
    }];

    [self setNeedsLayout];
    [self layoutIfNeeded];
    self.scrollView.contentSize = CGSizeMake(self.width, self.sourceBtnView.bottom + 10 + adaptNavagationBar);
}
@end
